<template>
    <div class="mv_list_all">
          
        <div class="top">
            <i class="iconfont icon-fanhui" @click="down"></i>
            <h2>推荐视频</h2>
        </div>
        <div class="uls">
            <ul class="mv_lists">
                <li v-if="index<moreNum" v-for="(item, index) in mv_box" :key="index">
                    <div class="mv_img" @click="watchMv(item.videoId,item)">
                        <img :src="item.bigHeadImg" alt="">
                    </div>
                    <p class="song_name">{{item.title}}</p>
                    <p class="singer">{{item.artists[0].name}}</p>
                </li>
                
            </ul>
            <div class="more" @click="moreBtn">
                    <p><i class="iconfont icon-icon04"></i></p>
                    <p>加载更多</p>
            </div>
        </div>
    </div>
</template>
<script>
import jsonp from "jsonp";
export default {
  name: "video_list",
  data() {
    return {
      mv_box: JSON.parse(sessionStorage.getItem("mv_box")),
      moreNum: "6"
    };
  },
  computed: {},
  methods: {
    watchMv(videoId, item) {
      this.$router.push("/Mv_play/" + videoId);
      this.$store.commit("agemv", item);

    },
    moreBtn() {
      this.moreNum = +this.moreNum + 6;
    },
    down() {
      this.$router.go(-1);
      this.$store.commit('changeIsplayMap',false);
    }
  },
  components: {},
  created() {
    jsonp(
      "http://uapi.yinyuetai.com/i/mv/favorite-list?uid=9&order=new&gid=&page=1&pageSize=3000",
      null,
      (err, res) => {
        if (!err) {
          // console.log(res);
          this.mv_box = res.videos;
          sessionStorage.setItem("mv_box", JSON.stringify(res.videos));
        } else {
          console.log(err);
        }
      }
    );
  }
};
</script>
<style lang="scss" scoped>
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#app {
  .playBox {
    bottom: 0;
  }
}

.mv_list_all {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  position: relative;
  z-index: 80;
  // 播放小组件

  // 顶部
  .top {
    height: 8%;
    background: #22c5bd;
    color: #fff;
    position: relative;
    i {
      position: absolute;
      left: 0.35rem;
      top: 0.4rem;
      font-size: 0.8rem;
    }
    h2 {
      font-size: 0.5rem;
      text-align: center;
      font-weight: normal;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }
  // 视频推荐
  .uls {
    width: 100%;
    height: 82%;
    overflow: auto;
  }
  .mv_lists {
    width: 100%;
    margin-top: 0.5rem;
    overflow: hidden;
    li {
      float: left;
      width: 49.5%;
      overflow: hidden;
      .mv_img {
        width: 100%;
        height: 3rem;
        background: paleturquoise;
        overflow: hidden;
        img {
          width: 100%;
        }
      }
      > p {
        margin-left: 0.2rem;
        margin-top: 0.1rem;
        line-height: 0.6rem;
      }
      .song_name {
        font-size: 12px;
        overflow: hidden;
        white-space: nowrap; /*强制显示一行*/
        text-overflow: ellipsis; /*溢出文字省略号处理*/
        width: 150px;
        // display: -webkit-box;
      }
      .singer {
        font-size: 10px;
        color: #aaaaaa;
      }
    }
    li:nth-of-type(2n + 2) {
      float: right;
    }
  }
  .more {
    width: 100%;
    height: 10%;
    background: #fff;
    padding: 0.3rem 0;
    border-top: 1px solid #f1f1f1;
    p {
      text-align: center;
      font-size: 0.2rem;
      color: #a4a4a4;
    }
  }
}
</style>
